package com.sufen.common.request;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:
 * @function:
 * @author: Liu Menglei
 * @Date: 2021/11/2 0002 22:56
 */
public class ResponseUtils {
    private static final Logger logger = LoggerFactory.getLogger(ResponseUtils.class);
    public ResponseUtils() {
    }

    public static void renderJson(HttpServletResponse response, String json) {
        response.setCharacterEncoding("utf-8");
        response.setContentType("application/json;charset=utf-8");

        try {
            response.getWriter().write(json);
        } catch (IOException var3) {
            logger.error("ResponseUtils.renderJson error",var3);
        }

    }
}